//
//  TradeHistoryTableViewCell.m
//  ZZLC
//
//  Created by 杨春至 on 2017/12/15.
//  Copyright © 2017年 ZhongZeng. All rights reserved.
//

#import "TradeHistoryTableViewCell.h"
#import "TradeHistoryModel.h"
@implementation TradeHistoryTableViewCell

- (void)configureCellByModel:(TradeHistoryModel *)model
{
    if ([model.type isEqualToString:@"cz"]||[model.type isEqualToString:@"zf"]) {
        self.chongzhiContentLabel.text =@"充值";
    }
    if ([model.type isEqualToString:@"lx"]) {
        self.chongzhiContentLabel.text =@"收益";
    }
    if ([model.type isEqualToString:@"tx"]) {
        self.chongzhiContentLabel.text =@"提现";
    }
    if ([model.type isEqualToString:@"buy"]) {
        self.chongzhiContentLabel.text =@"投资";
    }
    if ([model.type isEqualToString:@"back"]) {
        self.chongzhiContentLabel.text =@"返款";
    }
    if ([model.type isEqualToString:@"to"]) {
        self.chongzhiContentLabel.text =@"转入零钱包";
    }
    if ([model.type isEqualToString:@"out"]) {
        self.chongzhiContentLabel.text =@"转出零钱包";
    }
    if ([model.type isEqualToString:@"txfk"]) {
        self.chongzhiContentLabel.text =@"提现返款";
    }
    if ([model.type isEqualToString:@"jl"]) {
        self.chongzhiContentLabel.text =@"邀请奖励";
    }

    if ([model.status isEqualToString:@"0"]) {
        self.congzhiMoneyLabel.text = [NSString stringWithFormat:@"+%.2f",[model.money doubleValue]/100];
    }
    if ([model.status isEqualToString:@"1"]) {
        self.congzhiMoneyLabel.text = [NSString stringWithFormat:@"-%.2f",[model.money doubleValue]/100];
    }
    self.chongzhiBalanceLabel.text = [NSString stringWithFormat:@"%.2f",[model.usersCost doubleValue]/100];
    self.chongzhiTimeLabel.text = [self timeStampForMessageTime:[NSString stringWithFormat:@"%f",[model.insertTime doubleValue]/1000]];
    self.messageLabel.text = model.note;
}
-(NSString *)timeStampForMessageTime:(NSString *)strTime
{
    //实例化一个NSDateFormatter对象
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    
    //设定时间格式,这里可以设置成自己需要的格式
    
    [dateFormatter setDateFormat:@"yyyy-MM-dd  HH:mm:ss"];
    
    //用[NSDate date]可以获取系统当前时间
    
    NSString *currentDateStr = [dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:[strTime doubleValue]]];
    return currentDateStr;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
